
export function getUser(){
    let   user = null;
    user = ctx.request.header.cookie.split(";")[1].replace("user=","")
    return user
}

// 设置token
export function setToken(ctx,app,dataObj){
    const temp_data = {
        user :dataObj.usermsg,
        lifeTime:app.config.jw.lifeTime
    }
    
    console.log("setTOken+++++++++++++")
    console.log(temp_data);
    console.log("setToken end+++++++++++++++++++")
    
    const token = app.jwt.sign(temp_data, app.config.jwt.secret);
    ctx.header.token = token;
}


export function getToken(ctx,app){
    const msg = await app.jwt.decode(token);
    console.log("msg__________________")
    console.log(msg)
    return msg
}